{{- $pc := site.Config.Privacy.Disqus -}}
{{- if not $pc.Disable -}}
{{ if site.Config.Services.Disqus.Shortname }}<div id="disqus_thread"></div>
<script>
    window.disqus_config = function () {
        this.page.identifier = '{{ default .Identifier .Context.Params.disqus_identifier }}';
        this.page.title = '{{ default .Context.Title .Context.Params.disqus_title }}';
        this.page.url = '{{ default .Context.Permalink .Context.Params.disqus_url }}';

        {{ if eq .Identifier "/" }}
        this.callbacks.onReady.push(function () {
            window.aboutMasonry.layout();
        });
        {{ end }}
    };
    function initDisqus() {
        if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
            document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.';
            return;
        }
        var d = document, s = d.createElement('script'); s.async = true;
        s.src = '//' + {{ site.Config.Services.Disqus.Shortname }} + '.disqus.com/embed.js';
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    };
    setTimeout(() => {
        initDisqus();
    }, 3000);
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>{{end}}
{{- end -}}
